//
//  CenterMultiSelectionCellData.m
//  18Birdies
//
//  Created by poleness on 2017/3/2.
//  Copyright © 2017年 Lc. All rights reserved.
//

#import "CenterMultiSelectionCellData.h"
#import "CenterMultiSelectionCell.h"

@implementation CenterMultiSelectionCellData

+ (instancetype)cellDataWithTitle:(NSString*)title
                         selected:(BOOL)selected
                 onClickedHandler:(OnClickedHandler)clickedHandler {
  return [self cellDataWithTitle:title
                       titleFont:LcFont.gr17
                        selected:selected
                onClickedHandler:clickedHandler];
}

+ (instancetype)cellDataWithTitle:(NSString*)title
                        titleFont:(LcFont*)titleFont
                         selected:(BOOL)selected
                 onClickedHandler:(OnClickedHandler)clickedHandler {
  LC_CHECK_TRUE(title.length > 0);

  CenterMultiSelectionCellData* cellData = [[CenterMultiSelectionCellData alloc] init];
  cellData->_title = title;
  cellData.titleFont = titleFont;
  cellData.backgroundColor = [UIColor whiteColor];
  cellData.selected = selected;
  cellData.checkerClickedHandler = clickedHandler;
  cellData.clickable = NO;
  cellData.cellHeight = 44;
  return cellData;
}

- (Class)cellClazz {
  return CenterMultiSelectionCell.class;
}

- (NSString*)nibName {
  return @"CenterMultiSelectionCell";
}

- (void)refreshCell:(CenterMultiSelectionCell*)cell {
  [super refreshCell:cell];

  cell.checkerButton.selected = self.selected;
  cell.titleLabel.text = self.title;
  [cell.titleLabel setLcFont:self.titleFont];
  cell.backgroundColor = self.backgroundColor;
  cell.checkerClickedHandler = self.checkerClickedHandler;
}

@end
